//
//  ApplyForSuccessController.m
//  DA_V
//
//  Created by 周季阳 on 15/4/27.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "ApplyForSuccessController.h"
#import "InterFace.h"
#import "UIViewAdditions.h"

@interface ApplyForSuccessController ()
{
    NSTimer *zTimer;
    UILabel *numLabel;
}
@end

@implementation ApplyForSuccessController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [self colorWithHexString:@"#F5F5F5"];
    // Do any additional setup after loading the view.
    [self initNav];
    [self initUI];
}
#pragma mark - 返回
-(void)clickBackBtn{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - initUI
-(void)initUI{
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shape"]];
    imageView.frame = CGRectMake(0.294*SCREEN_WIDTH, 170, 22, 23);
    [self.view addSubview:imageView];
    
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(imageView.right, 165, 150, 30)];
    label.text = @"恭喜,申请完成";
    label.textAlignment = NSTextAlignmentLeft;
    label.textColor = [UIColor blackColor];
    label.font = [UIFont boldSystemFontOfSize:20];
    [self.view addSubview:label];
    
    UILabel *belowLabel = [[UILabel alloc]initWithFrame:CGRectMake(imageView.right, label.bottom-5, 150, 30)];
    belowLabel.text = @"请耐心等待审核结果";
    belowLabel.textAlignment = NSTextAlignmentLeft;
    belowLabel.textColor = [UIColor lightGrayColor];
    belowLabel.font = [UIFont boldSystemFontOfSize:14];
    [self.view addSubview:belowLabel];

    numLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, belowLabel.bottom+50, SCREEN_WIDTH, 30)];
    numLabel.text = @"3";
    numLabel.textAlignment = NSTextAlignmentCenter;
    numLabel.textColor = [UIColor blackColor];
    numLabel.font = [UIFont boldSystemFontOfSize:20];
    [self.view addSubview:numLabel];

    zTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(zTimerBegin) userInfo:nil repeats:YES];
}
-(void)zTimerBegin{
    NSInteger i = [[NSString stringWithFormat:@"%@",numLabel.text] integerValue];
    i--;
    numLabel.text = [NSString stringWithFormat:@"%ld",i];
    if (i==0) {
        [zTimer invalidate];
        zTimer = nil;
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
